<div id="container-fluid">
    <?php
    $schs = $viewModel->get('sch');
    include 'views/Include/alert.php';
    $cls = $viewModel->get("class");
    ?>
    <h3>List Lession</h3>
    <hr />
    <div class="form-inline">
        <div class="form-group">
            <label for="inputBeginDate">From: </label>
            <input type="text" class="iptDate" id="inputBeginDate" name="inputBeginDate" placeholder="dd/mm/yyyy">
            <label for="inputEndDate">To: </label>
            <input type="text" class="iptDate" id="inputEndDate" name="inputEndDate" placeholder="dd/mm/yyyy">
            <input type="button" class="btn btn-info" id="btnGetListSchedule" value="Get"/>
        </div>

    </div>
    <br>
    <form class="form-horizontal" method="POST">
        <div class="control-group">
            <label class="control-label" for="inputSubjectID">Class: </label>
            <div class="controls">
                <select id="inputScheduleClassBySch" name="classes_id">
                    <option value="-1">Select Class</option>
                    <?php
                    foreach ($cls as $cl) {
                        echo "<option value='" . $cl->classes_id . "'>" . $cl->classname . "</option>";
                    }
                    ?>
                </select>
            </div>
        </div>
    </form>
    <hr />
    <form action="<?php echo BASE_URL . 'schedule/delete'; ?>" method="POST" onsubmit="return ConfirmChoiceDeteleMulti();">
        <a class="btn btn-primary"  style="color: white" href="<?php echo BASE_URL . 'schedule/create' ?>">Add all lession of Subject</a>
        <a class="btn btn-info" style="color: white" href="<?php echo BASE_URL . 'schedule/single' ?>">Add a lession or day-off</a>
        <button type="submit" class="btn btn-danger">Detele</button>

        <div class="line"></div>
        <table class="table table-bordered table-hover table-condensed table-issue" id="tblSchedule">
            <thead>
                <tr>
                    <th></th>
                    <th>Class</th>
                    <th>Date</th>
                    <th>Lession</th>
                    <th>Theory</th>
                    <th>Lab</th>
                    <th>Control</th>
                </tr>
            </thead>
            <tbody>
                <?php
                if ($schs == NULL) {
                    echo '<tr><td colspan="7">Empty</td</tr>';
                } else {
                    ?>
                    <?php foreach ($schs as $sch) { ?>
                        <tr>

                            <td><input name="id[]" type="checkbox" id="checkboxId[]" value="<?php echo $sch->schedule_id; ?> "></td>
                            <td><?php echo $sch->classname ?></td>
                            <td><?php
                                $a = $sch->dates;
                                $spl = explode("-", $a);
                                echo "{$spl[2]}/{$spl[1]}/{$spl[0]}";
                                ?></td>
                            <td><?php
                                if (strpos($sch->lession_name, "#@@#@#@#@#") === FALSE) {
                                    echo $sch->lession_name;
                                } else {
                                    $nameDayOff = explode("#@@#@#@#@#", $sch->lession_name);
                                    echo $nameDayOff[1];
                                }
                                ?></td>
                            <td><?php echo $sch->theory ?></td>
                            <td><?php echo $sch->lab ?></td>
                            <td>
                                <a class="btn" href="<?php echo BASE_URL . 'schedule/update/' . $sch->schedule_id; ?>"><i class="icon-edit"></i></a>
                                <a class="btn btn-danger" href="#" onclick="ConfirmChoiceDelete('<?php echo BASE_URL . 'schedule/delete/' . $sch->schedule_id; ?>');
                                                return false;"><i class="icon-remove-sign"></i></a>
                            </td>
                        </tr>
                    <?php } ?>
                <?php } ?>

            </tbody>
        </table>
        <hr />
        <div id="smart-paginator"></div>
        <hr />
    </form>
</div>